import pandas as pd
import numpy as np
dates=pd.date_range("20130101",periods=6)
df=pd.DataFrame(np.arange(24).reshape((6,4)),
                index=dates,columns=["A","B","C","D"])
print(df)
print("-----------------")
print(df["A"])
print("-----------------")
print(df.A)
print("-----------------")
print(df[0:3]) #第一行到第三行
print("-----------------")
print(df["20130102":"20130104"])
print("-------标签筛选----------")
print(df.loc["20130102"])
print("-----------------")
print(df.loc[:,["A","B"]])
print("-----------------")
print(df.loc[["20130102","20130103"],["A","B"]])
print("--------位置筛选---------")
print(df.iloc[3])
print("-----------------")
print(df.iloc[3,1])
print("-----------------")
print(df.iloc[3:5,1])
print("-----------------")
print(df.iloc[[1,3,5],1:3])
print("------按条件筛选----------")
print(df[df.A>12])

